import ResMgr from "../Managers/ResMgr";
import MonsterBullet from "./MonsterBullet";

const { ccclass, property } = cc._decorator;

@ccclass
export default class BulletController extends cc.Component {

    private static Instance: BulletController = null;

    // LIFE-CYCLE CALLBACKS:
    public static getInstace() {
        if (BulletController.Instance == null) {
            BulletController.Instance = new BulletController;
        }
        return BulletController.Instance;
    }

    onLoad() {
        BulletController.Instance = this;
    }

    public create_bullet() 
    {
        var bullet_prefab = ResMgr.Instance.getAsset("Components", "Bullet");
        if (bullet_prefab) {
            var bullet = cc.instantiate(bullet_prefab);
            var bullet_Com = bullet.addComponent("Bullet");
        }

        return bullet;
    }


    public create_Monster_bullet() 
    {
        var bullet_prefab = ResMgr.Instance.getAsset("Components", "MonsterBullet");
        if (bullet_prefab) 
        {
            var bullet = cc.instantiate(bullet_prefab);
            bullet.addComponent("MonsterBullet");
        }
        
        return bullet;
    }


    start() {

    }



    // update (dt) {}
}
